package com.neuedu.page_objects;

import com.neuedu.bases.BasePage;
import org.openqa.selenium.By;
import org.openqa.selenium.chrome.ChromeDriver;

public class EmployeePage extends BasePage {
    public EmployeePage(ChromeDriver driver){
        super(driver);
    }

    public void Login()
    {
        waitSleep(1);
        findElement(By.cssSelector("[placeholder=username]")).sendKeys("123123");
        findElement(By.cssSelector("[placeholder=password]")).sendKeys("123123");
        waitSleep(1);
        findElement(By.className("login-btn")).click();
    }

    public void openNewProblem()
    {
        findElement(By.id("xinjian")).click();
    }

    public String getDialogTitle(){
        return findElement(By.cssSelector("span[class='el-dialog__title']")).getText();
    }

    public void xinjianConfirm()
    {
        findElement(By.id("xinjian_confirm")).click();
    }

    public void inputDescription(){
        findElement(By.className("el-textarea__inner")).sendKeys("暖气漏水");
    }

    public String getXinJianFail(){
        return findElement(By.cssSelector("p[class='el-message__content']")).getText();
    }

    public String getIssues_1(){
        return findElements(By.className("cell")).get(8).getText();
    }

    public String getIssues(int index){
        return findElements(By.className("cell")).get(index).getText();
    }

    public void viewDetail(){
        findElement(By.id("view_detail")).click();
    }

    public String getGoOff(){
        return findElement(By.id("go_off")).getText();
    }

    public void viewReason(){
        findElement(By.id("view_reason")).click();
    }

    public String getReasonClose(){
        return findElement(By.id("reason_close")).getText();
    }

    public void goOtherPage(int index){
        findElements(By.className("el-menu-item")).get(index).click();
    }

    public String getButtonId(String id){
        return findElement(By.id(id)).getText();
    }

    public void clickButton(String id){
        findElement(By.id(id)).click();
    }

    public void upload(){
        findElement(By.name("file")).sendKeys("D:\\Desktop\\things\\Gatlin\\gatlin1.jpg");
        findElements(By.className("el-textarea__inner")).get(1).sendKeys("窗户破碎");
    }

    public void upload_1(){
        findElement(By.name("file")).sendKeys("D:\\Desktop\\things\\Gatlin\\gatlin1.jpg");
    }
}
